using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ItemObject_Trigger : MonoBehaviour
{
    private ItemObject myItemObject => GetComponentInParent<ItemObject>();

    // 当触发器碰撞时调用
    private void OnTriggerEnter2D(Collider2D other)
    {
        // 检查碰撞对象是否是玩家
        if (other.GetComponent<Player>() != null)
        {
            if (other.GetComponent<CharacterStats>().isDead)
                return;
            // 拾取物品
            myItemObject.PickupItem();
        }
    }
}
